package com.zhang.spring.boot.mongo;

import com.zhang.data.mongo.core.MongoUtil;
import org.bson.Document;
import org.springframework.util.Assert;

import java.util.List;

public class SimpleMongoRepository<T> implements MongoRepository<T> {

    private MongoUtil mongoUtil;

    private Class<T> domainClass;

    public SimpleMongoRepository(MongoUtil mongoUtil, Class<T> domainClass) {
        Assert.notNull(mongoUtil,"mongoUtil");
        this.mongoUtil = mongoUtil;
        this.domainClass=domainClass;
    }

    @Override
    public List<T> saveAll(Iterable entities) {
        return null;
    }

    @Override
    public List<T> findAll() {
        List<T> list=mongoUtil.find(new Document(),domainClass);
        return list;
    }

    @Override
    public List<T> insert(Iterable entities) {
        return null;
    }

    @Override
    public T insert(Object entity) {
        return null;
    }
}
